<%@ page import="com.zou.beans.Photo" %>
<%@ page import="com.zou.dao.BaseDao" %>
<%@ page import="com.zou.beans.User" %>
<%@ page import="java.util.List" %>
<%@ page import="com.zou.beans.Comment" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css" rel="stylesheet">
</head>
<%
    User user = (User) session.getAttribute("User");
    if (user == null) {
        response.sendRedirect("login.jsp");
    }
    Photo photo = (Photo) request.getAttribute("LargePhoto");
    List<Comment> comments = (List<Comment>) request.getAttribute("Comments");
%>
<!--顶部导航栏部分-->
<nav class="navbar navbar-dark sticky-top bg-success flex-md-nowrap p-0 shadow">
    <a class="navbar-brand col-md-3 col-lg-2 mr-0 px-3"
       href="https://blog.csdn.net/Zou_05">&emsp;&emsp;&emsp;小邹喜欢Java</a>
    <div class="btn-group" style="margin-right: 100px">
        当前用户：<%=user.getName()%>
    </div>
</nav>
<body style="background: #cccccc;">
<div style="margin: 0 auto;width: 600px;padding-top: 20px">
    <a class="btn btn-outline-success" href="javascript:history.go(-1);" style="float: left">
        < 返回
    </a>
    <h3 align="center">
        <a class="btn btn-outline-primary" href="PhotoWallServlet" style="float: left;margin-left: 10px">首页</a>
        <%=photo.getName()%>
        <a class="btn btn-outline-info" href="AddPhotoCollectionServlet?photoId=<%=photo.getId()%>&flag=01"
           style="float: right">♥ 收藏
        </a>
    </h3>
    <img src="<%=photo.getUrl()%>" style="width: 100%;padding-top: 10px"><br><br>
    <h3>评论区</h3>
    <hr color="#ccc">
    <%
        for (Comment comment : comments) {
    %>
    <li><span style="color: blueviolet"><%=comment.getUserName()%></span><%=" 说 :  " + comment.getContent()%>
    </li>
    <%}%>
    <br><br>
    <form action="AddCommentsServlet" method="post">
        <input type="hidden" name="photoId" value="<%=photo.getId()%>">
        <textarea name="content" cols="80" rows="3" required="required"></textarea><br><br>
        <input class="btn btn-success" type="submit" value="我要发表" style="float: right">
    </form>
    <br><br>
</div>


</body>
</html>
